home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / fortran.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  7.8 KB  |  182 lines

  1. " Vim syntax file
  2. " Language:    Fortran
  3. " Maintainer:    Preben "Peppe" Guldberg <c928400@student.dtu.dk>
  4. "        Original author: Mario Eusebio
  5. " Last change:    Sat Feb 14 21:27:58 1998
  6.  
  7. " Remove any old syntax stuff hanging around
  8. syn clear
  9.  
  10. syn case ignore
  11.  
  12. syn keyword fortranStatement        return continue
  13. syn keyword fortranLabel        go to goto
  14. syn keyword fortranConditional        if else elseif endif then
  15. syn keyword fortranRepeat        do
  16.  
  17. syn keyword fortranTodo         contained TODO
  18.  
  19. syn region fortranString        start=+"+ end=+"+    oneline
  20. syn region fortranString        start=+'+ end=+'+    oneline
  21.  
  22. " Format strings are used with READ, WRITE and PRINT
  23. " READ and PRINT can be used without paretheses (and '(...)' is caught as '...' )
  24. " FMTs can span several lines. This is not supoorted here for simple READ and PRINT
  25. syn match  fortranReadWrite        "\<\(read\|print\)\>"
  26. syn region fortranFormatString        contained start=+'(+ end=+)'+ contains=fortranContinueLine
  27. syn region fortranReadWriteFunc        matchgroup=fortranReadWrite start="\(read\|write\)\s*("rs=e-1,he=e-1 skip=")'" matchgroup=NONE end=")" contains=fortranFormatString
  28.  
  29. " If you don't like initial tabs in fortran (or at all)
  30. "syn match fortranIniTab        "^\t.*$"
  31. "syn match fortranTab            "\t"
  32.  
  33. " This is valid with Gnu Fortran
  34. "syn match  fortranSpecial contained "\\\d\{3}\|\\."
  35. "syn region fortranString    start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=fortranSpecial
  36. "syn region fortranString    start=+'+ skip=+\\\\\|\\"+ end=+'+ contains=fortranSpecial
  37.  
  38. " Any integer
  39. syn match fortranNumber        "-\=\<\d\+\>"
  40. " floating point number, with dot, optional exponent
  41. syn match fortranFloat        "\<\d\+\.\d*\([edED][-+]\=\d\+\)\=\>"
  42. " floating point number, starting with a dot, optional exponent
  43. syn match fortranFloat        "\.\d\+\([edED][-+]\=\d\+\)\=\>"
  44. " floating point number, without dot, with exponent
  45. syn match fortranFloat        "\<\d\+[edED][-+]\=\d\+\>"
  46.  
  47. syn match fortranOperator        "\.\(gt\|ge\|\lt\|\e\)\."
  48. syn match fortranOperator        "\.\(eq\|ne\|eqv\|neqv\)\."
  49. syn match fortranOperator        "\.\(and\|or\|not\)\."
  50.  
  51. syn match fortranLogicalConstant    "\.\(true\|false\)\."
  52.  
  53. "syn match fortranIdentifier        "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
  54.  
  55. "syn match fortranDelimiter        "[()]"
  56.  
  57. " any character other than a 'c' or '!' in the first column is an error
  58. " (labelnumbers iare handled below, though)
  59. syn match fortranCommentError        "^\ \{,4}[^\ \t0-9].*$"
  60. syn match fortranComment    "^[cC*].*$"    contains=fortranTodo,fortranTab
  61. syn match fortranComment    "!.*$"        contains=fortranTodo,fortranTab
  62. syn match fortranContinueLine        "^\ \{5}\S"ms=e
  63.  
  64. syn match fortranNoLabelNumber        "^\d\{5}\S.*$"
  65. syn match fortranNoLabelNumber        "^\ \d\{4}\S.*$"
  66. syn match fortranNoLabelNumber        "^\ \{2}\d\{3}\S.*$"
  67. syn match fortranNoLabelNumber        "^\ \{3}\d\{2}\S.*$"
  68. syn match fortranNoLabelNumber        "^\ \{4}\d\S.*$"
  69.  
  70. syn match fortranLabelNumber        "^\d\{1,5}\>"
  71. syn match fortranLabelNumber        "^\ \d\{1,4}\>"
  72. syn match fortranLabelNumber        "^\ \{2}\d\{1,3}\>"
  73. syn match fortranLabelNumber        "^\ \{3}\d\{1,2}\>"
  74. syn match fortranLabelNumber        "^\ \{4}\d\>"
  75.  
  76. "syn match fortranPreCondit        "^#define\>"
  77. "syn match fortranPreCondit        "^#include\>"
  78.  
  79. " Treat all past 72nd column as a comment. Do not work with tabs!
  80. " Breaks down when 72-73rd column is in another match (eg number or keyword)
  81. "syn match  fortranComment        "^.\{-72}.*$"lc=72
  82.  
  83. syn keyword fortranType        character complex double implicit integer
  84. syn keyword fortranType        logical precision real real*8
  85.  
  86. syn keyword fortranStructure    common dimension equivalence external
  87. syn keyword fortranStructure    intrinsic parameter save
  88.  
  89. syn keyword fortranUnitHeader    call data end function program subroutine
  90.  
  91. " READ, WRITE and PRINT are handled above (as they take FMT arguments)
  92. syn keyword fortranReadWrite    backspace close inquire open rewind
  93.  
  94. syn keyword fortranFormat    access blank err file fmt form format
  95. syn keyword fortranFormat    iostat rec recl status unit
  96.  
  97. syn keyword fortranStopPause    stop pause
  98.  
  99. syn keyword fortranImplicit    abs acos aint atan asin cos cosh aimag
  100. syn keyword fortranImplicit    anint atan2 char cmplx conjg dble dim
  101. syn keyword fortranImplicit    dprod exp ichar index int len lge lgt
  102. syn keyword fortranImplicit    lle llt log log10 max min mod nint sin
  103. syn keyword fortranImplicit    sinh sign sqrt tan tanh
  104.  
  105. syn keyword fortranSpecific    cabs ccos cexp clog csin csqrt dabs
  106. syn keyword fortranSpecific    dacos dasin datan datan2 dcos dcosh
  107. syn keyword fortranSpecific    ddim dexp dint dlog dlog10 dmod
  108. syn keyword fortranSpecific    dnint dsign dsin dsinh dsqrt dtan
  109. syn keyword fortranSpecific    dtanh iabs idim idnint isign
  110.  
  111. " This syntax highlighting file support Fortran 77 by default
  112. "syn keyword fortranExtended    allocate assign block case contains cycle
  113. "syn keyword fortranExtended    deallocate default elsewhere enddo endfile
  114. "syn keyword fortranExtended    endwhile entry equivalence exit interface
  115. "syn keyword fortranExtended    module nullify only operator procedure
  116. "syn keyword fortranExtended    recursive select use where while allocatable
  117. "syn keyword fortranExtended    in include inout intent kind namelist none
  118. "syn keyword fortranExtended    optional out pointer private public result
  119. "syn keyword fortranExtended    sequence target type achar adjustl adjustr
  120. "syn keyword fortranExtended    all allocated any bit_size break btest carg
  121. "syn keyword fortranExtended    ceiling conjg count cshift date_and_time
  122. "syn keyword fortranExtended    digits dim dot_product dvchk eoshift epsilon
  123. "syn keyword fortranExtended    error exponent floor flush fraction getcl
  124. "syn keyword fortranExtended    huge iachar iand ibclr ibits ibset ichar
  125. "syn keyword fortranExtended    ieor intrup invalop ior iostat_msg ishft
  126. "syn keyword fortranExtended    ishftc lbound len_trim matmul maxexponent
  127. "syn keyword fortranExtended    maxloc maxval merge minexponent minloc minval
  128. "syn keyword fortranExtended    modulo mvbits nbreak ndperr ndpexc nearest
  129. "syn keyword fortranExtended    nint not offset ovefl pack precfill present
  130. "syn keyword fortranExtended    product prompt radix random_number random_seed
  131. "syn keyword fortranExtended    range repeat reshape rrspacing scale scan
  132. "syn keyword fortranExtended    segment selected_int_kind selected_real_kind
  133. "syn keyword fortranExtended    set_exponent shape signsize spacing spread
  134. "syn keyword fortranExtended    sum system system_clock timer tiny transfer
  135. "syn keyword fortranExtended    transpose trim ubound undfl unpack val
  136. "syn keyword fortranExtended    verify action blank blocksize carriagecontrol
  137. "syn keyword fortranExtended    direct exist form formatted from location
  138. "syn keyword fortranExtended    name named nextrec number opened recl
  139. "syn keyword fortranExtended    recordtype sequential stat unformatted
  140.  
  141. if !exists("did_fortran_syntax_inits")
  142.   let did_fortran_syntax_inits = 1
  143.   " The default methods for highlighting.  Can be overridden later
  144.   hi link fortranStatement        Statement
  145.   hi link fortranLabel            Special
  146.   hi link fortranConditional        Conditional
  147.   hi link fortranRepeat            Repeat
  148.   hi link fortranTodo            Todo
  149.   hi link fortranString            String
  150.   hi link fortranFormatString        fortranString
  151.   hi link fortranNumber            Number
  152.   hi link fortranFloat            Float
  153.   hi link fortranOperator        Operator
  154.   hi link fortranLogicalConstant    Constant
  155.   hi link fortranCommentError        Error
  156.   hi link fortranComment        Comment
  157.   hi link fortranContinueLine        Todo
  158.   hi link fortranLabelNumber        Special
  159.   hi link fortranNoLabelNumber        Error
  160.   hi link fortranType            Type
  161.   hi link fortranStructure        fortranType
  162.   hi link fortranUnitHeader        fortranPreCondit
  163.   hi link fortranReadWrite        fortranImplicit
  164.   hi link fortranFormat            fortranImplicit
  165.   hi link fortranStopPause        fortranImplicit
  166.   hi link fortranImplicit        Identifier
  167.   hi link fortranSpecific        fortranImplicit
  168.  
  169.   " optional highlighting
  170.   "hi link fortranIdentifier        Identifier
  171.   "hi link fortranDelimiter        Identifier
  172.   "hi link fortranPreCondit        PreCondit
  173.   "hi link fortranIniTab        Error
  174.   "hi link fortranTab            Error
  175.   "hi link fortranExtended        fortranImplicit
  176.   "hi link fortranSpecial        Special
  177. endif
  178.  
  179. let b:current_syntax = "fortran"
  180.  
  181. "EOF    vim: ts=8 noet tw=120 sw=8 sts=0
  182.